home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.04 Apr 91 / NonStandard File / NonStandard File Main next >
Encoding:
Text File  |  1991-02-08  |  1.3 KB  |  44 lines  |  [TEXT/PJMM]

  1. {****************************}
  2. {}
  3. {    Non-Standard File Test}
  4. {        Created by Steve Sheets}
  5. {}
  6. {        Examples of using NonStandardFile unit.}
  7. {}
  8. {****************************}
  9.  
  10. program NonStandardFileTest;
  11.  
  12.     uses
  13.         NonStandardFile;
  14.  
  15.     var
  16.         gGood: BOOLEAN;
  17.         gRefNum: INTEGER;
  18.         gFileName: Str255;
  19.         gType: OSType;
  20.         gTypeList: SFTypeList;
  21.         gNameList: array[0..1] of Str255;
  22.         gFlag: BOOLEAN;
  23.         gNum: INTEGER;
  24.         gIcon1, gIcon2, gIcon3: Handle;
  25.  
  26. begin
  27.     NSPutFile('Please enter the name of the file you wish to save:', 'File Name', gGood, gRefNum, gFileName);
  28.  
  29.     NSSelectPutFile('Save copy of Document to disk:', 'Save copy of Selection to disk:', 'File Name', gGood, gRefNum, gFileName, gFlag);
  30.  
  31.     gTypeList[0] := 'TEXT';
  32.     gNameList[0] := 'Text files';
  33.     gTypeList[1] := 'PNTG';
  34.     gNameList[1] := 'MacPaint files';
  35.     NSGetFile('Please select a file:', 2, @gTypeList, @gNameList, gGood, gRefNum, gFileName, gType);
  36.  
  37.     gIcon1 := GetResource('ICN#', 1000);
  38.     gIcon2 := GetResource('ICN#', 1001);
  39.     gIcon3 := GetResource('ICN#', 1002);
  40.     NSIconPutFile('Name', 1, gIcon1, gIcon2, gIcon3, nil, 'MacPaint', 'Text', 'PICT', '', 'Save copy file to MacPaint document:', 'Save file as Text document:', 'Save copy file to PICT document:', '', gGood, gRefNum, gFileName, gNum);
  41.     ReleaseResource(gIcon1);
  42.     ReleaseResource(gIcon2);
  43.     ReleaseResource(gIcon3);
  44. end.